package com.guocheng.modules.emp.model.po;


import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.guocheng.common.annotation.TerminalRequest;
import com.guocheng.common.annotation.TerminalResponse;
import com.guocheng.modules.emp.utils.EmpRequestUtils;
import com.guocheng.modules.emp.utils.EmpResponseUtils;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 人员信息实体类
 */
@Data
@Accessors(chain = true)
@TableName("gc_emp")
public class Emp extends Object implements Serializable {
    //员工id
    @TableId(type = IdType.AUTO)
    @TerminalResponse("id")
    private Integer id;
    //员工姓名
    @TerminalResponse("name")
    @TerminalRequest("name")
    private String name;
    //员工工号
    @TerminalRequest("job_number")
    private String jobNumber;
    //员工性别
    @TerminalRequest(value = "gender",utils = EmpRequestUtils.class,methods = "gender",arg = String.class)
    private String sex;
    //证件号
    private String number;
    //头像图片位置
    @TerminalRequest("avatar")
    private String avatar;
    //联系电话
    @TerminalRequest("phone")
    private String telephone;
    //出生日期
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") //数据回显
    private Date birthday;
    //部门名称
    @TerminalRequest("department")
    private String deptName;
    //部门编号
    private Integer deptId;
    //类别名称
    private String classessName;
    //人员类别
    private String classesId;
    //入职日期
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") //数据回显
    @TerminalResponse(value = "entry_date",utils = EmpResponseUtils.class,methods = "entryDate",arg = Integer.class)
    private Date entryDate;         //在controller有写wrapper
    //状态
    private Integer status;     //1启用，-1禁用
    //备注
    private String description;
    //创建时间
    @TableField(fill = FieldFill.INSERT)//新增有效
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") //数据回显
    private Date createDate;

    //识别照片
    @TableField(exist = false)
    @TerminalResponse(value = "photos",utils = EmpResponseUtils.class,methods = "photos",arg = List.class)
    private List<String> photos;  //存放位置或64编码
}
